/**
 * Created by luoxuan on 2017/7/5.
 */

//  npm install gulp gulp-minify-css gulp-concat gulp-uglify --save-dev

var gulp = require('gulp');
var minifycss = require('gulp-minify-css'); //  压缩CSS
var concat = require('gulp-concat');        //  拼接文件
var uglify = require('gulp-uglify');        //  压缩js


gulp.task('minifyCss', function() {
    return gulp.src('src/*.css')            //压缩的文件
        .pipe(minifycss())                  //执行压缩
        .pipe(gulp.dest('dist/css'));       //输出文件夹
});

gulp.task('minifyJs', function() {
    return gulp.src('src/*.js')
        .pipe(concat('main.js'))            //合并所有js到main.js
        .pipe(rename({suffix: '.min'}))     //rename压缩后的文件名
        .pipe(uglify())                     //压缩
        .pipe(gulp.dest('dist/js'));        //输出
});